package cn.itsource.org.mapper;

import cn.itsource.basic.mapper.BaseMapper;
import cn.itsource.org.domain.Department;

import java.util.List;

public interface DepartmentMapper extends BaseMapper<Department> {


    /**
     * 查询一级和二级部门(具有层次结构的)
     *      结构为：
     *              一级部门1
     *                |__children[二级部门1,二级部门2...]
     *                |
     *              一级部门2
     *                |__children[二级部门1,二级部门2...]
     *
     *
     * @return
     */
    List<Department> loadOneLevelAndTwoLevelDepartments();

    /**
     * 根据父id查询所有的子部门
     * @param pid
     * @return
     */
    List<Department> loadByParentId(Long pid);
}
